package graph;

public class Edge<T,V> {
	public Node<T> a,b;
	public V data;
	public Edge(Node<T> aa, Node<T> bb) {
		this(aa,bb,null);
	}
	public Edge(Node<T> aa, Node<T> bb, V d) {
		a=aa;
		b=bb;
		data = d;
	}
	@Override
	public String toString() {
		return "Edge [" + a.data + "-" + b.data + "]";
	}
	public Node<T> opposite(Node<T> n) {
		return n == a ? b : a;
	}
}
